﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace LsoaClass.SystemMaintain
{
    public class Menu
    {
        public static UAPCallResult funResult = new UAPCallResult();

        /// <summary>
        /// 获取菜单分类列表
        /// </summary>
        /// <returns>返回代码和提示信息组合成的字符串</returns>
        public string getMenuTypeList(out LsDataSet LsDs)
        {
            LsDs = null;
            DBClass dbc = new DBClass();
            try
            {
                string strsql = "select * from MenuType_T where IsUse=1 order by OrderNo";
                LsDs = dbc.getLsDataSetBySql(strsql);
                funResult.Code = 0;
                funResult.Msg = "获取菜单分类列表成功。";
            }
            catch (Exception ex)
            {
                funResult.Code = 13120000;
                funResult.Msg = "获取菜单分类列表失败。" + ex.Message;
            }
            finally
            {
                dbc.close();
            }
            return funResult.RetStr;
        }

        /// <summary>
        /// 获取菜单列表
        /// </summary>
        /// <returns>返回代码和提示信息组合成的字符串</returns>
        public string getMenuList(out LsDataSet LsDs)
        {
            LsDs = null;
            DBClass dbc = new DBClass();
            try
            {
                string strsql = @"select b.Keyword,a.* from Menu_T a,MenuType_T b 
                                where a.TypeName=b.Name and b.IsUse=1 and a.Enabled=1
                                order by a.OrderNo";
                LsDs = dbc.getLsDataSetBySql(strsql);
                funResult.Code = 0;
                funResult.Msg = "获取菜单分类列表成功。";
            }
            catch (Exception ex)
            {
                funResult.Code = 13120000;
                funResult.Msg = "获取菜单分类列表失败。" + ex.Message;
            }
            finally
            {
                dbc.close();
            }
            return funResult.RetStr;
        }
    }
}
